<template>
  <div class="dialog">
    <div class="content">
      <div class="top">
        <span>添加商品</span>
      </div>
      <div class="mid">
        <br />
        <br />
        <label>商品名称</label>
        <input type="text" v-model="goodsName" />
        <br />
        <br />
        <label>商品价格</label>
        <input type="text" v-model="goodsPrice" />
        <br />
        <br />
        <label>商品数量</label>
        <input type="text" v-model="goodsNum" />
        <br />
        <br />
        <br />
        <br />
      </div>
      <div class="bottom">
        <button @click="isShow = false">取消</button>
        <button @click="suerAdd">确认</button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      goodsName: "",
      goodsPrice: 0,
      goodsNum: 1,
    };
  },
  methods: {
    // 确认添加
    suerAdd() {
      let goodsData = {
        name: this.goodsName,
        price: this.goodsPrice * 1,
        num: this.goodsNum * 1,
        isChecked: false,
      }
      this.$emit('suerAdd', goodsData);
    },
  },
};
</script>

<style>
.dialog {
  width: 100vw;
  height: 100vh;
  background-color: rgba(200, 200, 200, 0.9);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
}
.content {
  width: 400px;
  height: 300px;
  margin: 100px auto 0;
  background-color: #fff;
  border-radius: 8px;
  padding: 10px;
}
</style>